'use strict';

var mongoose = require('mongoose'),
    Schema = mongoose.Schema,
    baseController = require('../../../Base/server/controllers/BaseDoc.js');

var newModel = baseController.getBaseDocFields();
newModel.AppID = {
    type: String,
    default: '',
    trim: true,
    unique: '应用ID已存在',
    required: '请输入AppID',
};

newModel.Name = {
    type: String,
    default:'',
    trim: true,
    required: '请输入App名称'
};

newModel.FileName = {
    type: String,
    default:'',
    trim: true,
    required: '安装文件不能为空'
};
newModel.FileSize = {
    type: Number
};

newModel.DisplayImage = {
    type: String,
    default: '',
    trim: true
};
newModel.DisplayImageSize = {
    type: Number
};

newModel.MouseDownImage = {
    type: String,
    default: '',
    trim: true
};
newModel.MouseDownImageSize = {
    type: Number
};

newModel.Version = {
    type: String,
    default: '',
    trim: true,
    required: '请输入版本号',
};

//描述
newModel.Describe = {
    type: String,
    default: '',
    trim: true
};

//备注
newModel.Remark = {
    type: String,
    default: '',
    trim: true
};

//是否共享
newModel.IsShared = {
    type: Boolean
};

newModel.IsEffective = {
    type: Boolean
};

var newSchema = new Schema(newModel);
newSchema.index({Name: 1});
newSchema.index({Code: 1});

mongoose.model('App', newSchema, 'App');
